<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>echarts</title>
    <style>
        div {
            width: 600px;
            height: 600px;
        }
    </style>
</head>

<body>
    <div class="demo1"></div>
    <div class="demo2"></div>
    <script src="echarts.js"></script>
    <script>
        let mychart1 = echarts.init(document.querySelector('.demo1'));
        var option = {
            title: {
                text: '柱状图'
            },
            legend: {
                data: ['销量']
            },
            xAxis: {
                data: ['EDG', 'RNG', 'FPX', 'IG', 'SN']
            },
            yAxis: {},
            series: [
                {
                    name: '销量',
                    type: 'bar',
                    data: [12, 34, 45, 56, 43],
                },
                {
                    name: '价格',
                    type: 'bar',
                    data: [43, 32, 45, 56, 43],
                }
            ]
        }
        mychart1.setOption(option);

        let mychart2 = echarts.init(document.querySelector('.demo2'));
        var option = {
            title: {
                text: '饼图'
            },
            legend: {
                data: ['支持率']
            },
            series: [
                {
                    name: '支持率',
                    type: 'pie',
                    data: [
                        { name: 'IG', value: 12 },
                        {name:'RNG',value:32},
                        { name: 'IG', value: 12 },
                        {name:'RNG',value:32},
                        { name: 'IG', value: 12 },
                        {name:'RNG',value:32},
                        { name: 'IG', value: 12 },
                        {name:'RNG',value:32},
                        
                    ],
                },
            ]
        }
        mychart2.setOption(option);
    </script>
</body>

</html>